<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="UTF-8">
  <title>Task -v10</title>
  <link rel="stylesheet" href="../../../static/css/bootstrap.min.css"/>

  <style type="text/css">
    .site-bgcolor {
      background: AliceBlue
    }
  </style>

</head>
<body>
<div id="app" class="container-fluid">

  <div class="row-fluid">
    <div class="col-sm-12">
      <h3 class="page-header text-center">
        任务管理
        <small>{{modeTitle}} (Task Viewer)</small>
      </h3>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <br/>
    </div>
  </div>

  <div class="row">
    <div class="collapse col-sm-12" id="advancedsearch">
      <div class="well">
        <div class="row">
          <!-- <form class="form-horizontal contract-form"> -->
          <div class="form-group">

            <label class="col-sm-1 control-label">criterion</label>

            <div class="col-sm-5">
              <input id="begintime" name="begintime" type="text" v-model="criterion" value="2015-01-01" required/>
            </div>

            <label class="col-sm-1 control-label">pagenum</label>

            <div class="col-sm-5">
              <input id="endtime" name="endtime" type="text" v-model="pagenum" value="2015-02-01" required/>
            </div>

          </div>

          <div class="form-group">

            <label class="col-sm-1 control-label">pagesteps</label>

            <div class="col-sm-5">
              <input id="deviceid" name="deviceid" type="text" v-model="pagesteps" value="" class="form-control"
                     required/>
            </div>

          </div>
          <div class="form-group">

            <div class="col-sm-offset-9 col-sm-1">
              <button class="btn btn-outline btn-block btn-warning">清除</button>
            </div>
            <div class="col-sm-2">
              <button id='submitbutton' class="btn btn-outline btn-block btn-success save"
                      v-on:click="advancedsearch($event)">提交
              </button>
            </div>
          </div>
          <!-- </form> -->
        </div>
      </div>
    </div>
  </div>


  <div id="objectviewer" class="row" v-show="mode=='modeItemView'">
    object viewer
  </div>

  <div id="objectlist1" v-show="mode=='modeList'">
    <div class="row">
      <itemsearch :item="curitem" :on-remove="onRemove" :on-add="onAdd"></itemsearch>
      <itemlist :mode="mode" :items="items" :on-edit="onEdit" :on-remove="onRemove" :pagenum="pagenum"></itemlist>
    </div>
  </div>

  <div id="objecteditor" v-show="mode=='modeAddNew'">
    <div class="row">
      <itemeditor :mode="mode" :item="curitem" :on-submit="onSave" :on-cancel="onCancel"></itemeditor>
    </div>
  </div>

  <div id="objecteditor2" v-show="mode=='modeEdit'">
    <div class="row">
      <itemeditor :mode="mode" :item="curitem" :on-submit="onSave" :on-cancel="onCancel"></itemeditor>
    </div>
  </div>

  <div id="objectdetails" v-show="mode=='modeDetails'">
    <div class="row">
      <itemdetails :mode="mode" :items2="curitem" :on-cancel="onCancel"></itemdetails>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12">
      <hr/>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12 text-center">
      <span>{{curdate}}</span>
    </div>
  </div>

  <div class="row">
    <div class="col-sm-12 text-center"><br/></div>
  </div>

  <!--	<pre>
            <div>{{ $curitem | json }}</div>
            <div>{{ $data | json }}</div>
        </pre>-->
</div>
<!-- app -->

<template id="itemsearch-tpl">
  <div class="col-sm-12">
    <div class="col-sm-3">
      <button class="btn btn-default" href="#add" v-on:click="onAdd()">新增</button>
      <button class="btn btn-default" v-on:click="onRemoveSelected()">删除选中记录</button>
    </div>
    <div class="col-sm-offset-3 col-sm-3">
      <input id="searchQuery" name="query" type="text" style="float:right" v-model="searchQuery" class="form-control"
             required/>
    </div>
    <div class="col-sm-2">
      <button id='search' class="btn btn-outline btn-block btn-primary" v-on:click="basicsearch($event)"><strong>搜索全部</strong>
      </button>
    </div>
    <div class="col-sm-1 text-left vertical-middle-sm">
      <h5><strong>
        <a role="button" class="control-label" data-toggle="collapse" href="#advancedsearch" aria-expanded="false"
           aria-controls="advancedsearch">高级...</a>
      </strong></h5>
    </div>
  </div>
</template>
<!--/itemsearch-tpl-->

<template id="itemeditor-tpl">
  <div class="col-sm-12">
    <!-- <form class="form-horizontal"> -->
    <div class="form-horizontal">
      <div class="site-bgcolor">
        <hr/>
        <div class="form-group">
          <label for="id" class="col-sm-1 control-label">唯一标识</label>

          <div class="col-sm-4">
            <input class="form-control" id="id" v-model="item.id" disabled>
          </div>
        </div>

        <div class="form-group">
          <label for="principal" class="col-sm-1 control-label">负责人</label>

          <div class="col-sm-4">
            <input class="form-control" id="principal" v-model="item.principal">
          </div>
        </div>


        <div class="form-group">
          <label for="description" class="col-sm-1 control-label">描述</label>

          <div class="col-sm-4">
            <textarea class="form-control" id="description" v-model="item.description"></textarea>
          </div>
        </div>


        <div class="form-group">
          <label for="deadline" class="col-sm-1 control-label">截止期</label>

          <div class="col-sm-4">
            <input type="date" class="form-control" id="deadline" v-model="item.deadline">
          </div>
        </div>

        <div class="form-group">
          <label for="state" class="col-sm-1 control-label">状态</label>

          <div class="col-sm-4">
            <select id="state" v-model="item.state" >
              <option value="0">未完成</option >
              <option value="1">执行中</option>
              <option value="9">已完成</option>
            </select>
          </div>
        </div>

        <div class="form-group" >
          <div class="col-sm-3 col-md-push-9">
            <button class="btn btn-default" v-on:click="onCancelClick($event)">取消</button>
            <button class="btn btn-default" v-on:click="onSubmitClick($event)">提交</button>
          </div>
        </div>
      </div>
    </div>
    <!-- </form> -->
  </div>
</template>

<template id="itemlist-tpl" class="container-fluid">
  <div class="table-responsive col-sm-12">
    <ul class="media-list row contacts-container"></ul>
    <div class="col-md-11">
      <div class="form-group form-inline pull-right">
        <label>页面记录数：</label>
        <select id="pagenum" v-model="pagenum" class="form-control" >
          <option value="5">5</option>
          <option value="10">10</option>
          <option value="15" selected>15</option>
        </select>
        <button class="btn btn-default" v-on:click="onPagenum()">确定</button>
      </div>
    </div>
    <table class="table table-bordered table-condensed table-striped" style="word-break:break-all">
      <br/>
      <thead>
      <tr class="info">
        <th>选择</th>
        <th>唯一标识</th>
        <th>负责人</th>
        <th>描述</th>
        <th>截止期</th>
        <th>状态</th>
        <th>操作</th>
      </tr>
      </thead>
      <tbody>
      <tr v-for="item in items">
        <td><input type="checkbox" v-model="item.selected"></td>
        <td width="18%"><a href="#" v-on:click="onDetailsItem('modeDetails',item)"> {{item.id}} </a></td>
        <td width="5%">{{item.principal}}</td>
        <td width="50%">{{item.description}}</td>
        <td width="12%">{{item.deadline}}</td>
        <td v-if="item.state==0">未完成</td>
        <td v-if="item.state==1" >执行中</td>
        <td v-if="item.state==9">已完成</td>
        <td>
          <a href="#" v-on:click="onRemoveItem(item,$event)"> 删除 </a> |
          <a href="#" v-on:click="onEditItem(item,$event)"> 编辑 </a>
        </td>
      </tr>
      </tbody>
    </table>
  </div>
  <div id="paging" align="center"></div>
</template>

<template id="itemdetails-tpl" class="container-fluid">
  <div class="table-responsive col-sm-12">
    <ul class="media-list row contacts-container"></ul>
    <table class="table table-bordered table-condensed table-striped" style="word-break:break-all">
      <thead>
      <tr class="info">
        <th>唯一标识</th>
        <th>负责人</th>
        <th>描述</th>
        <th>截止期</th>
        <th>状态</th>
      </tr>
      </thead>
      <tbody>
      <td width="18%"><a href="#" v-on:click="onChangeItem(item)"> {{items2.id}} </a></td>
      <td width="5%">{{items2.principal}}</td>
      <td width="50%">{{items2.description}}</td>
      <td width="12%">{{items2.deadline}}</td>
      <td v-if="items2.state==0">未完成</td>
      <td v-if="items2.state==1" >执行中</td>
      <td v-if="items2.state==9">已完成</td>
      </tbody>
    </table>
    <div class="form-group">
      <div class="col-sm-3 col-md-push-9">
        <button class="btn btn-default" v-on:click="onCancelClick($event)">返回</button>
      </div>
    </div>
  </div>
</template>
<script src="../../../node_modules/jquery/dist/jquery.js"></script>
<script src="../../../lib/layPage/laypage.js"></script>
<script src="../../../node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../../../node_modules/vue/dist/vue.js"></script>
<script src="../../../lib/vue-resource/0.7.0/vue-resource.js"></script>
<script src="task-v10.js"></script>
</body>
</html>
